class Solution {
public:
    string removeDuplicates(string s) {
        string stack = "";
        for(auto& e : s)
        {
            if(stack.size() == 0 || stack.back() != e)
                stack += e;
            else
                stack.pop_back();
        }
        return stack;
    }
};